package com.example.service;

import com.example.domain.User;
import com.example.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserService {

    @Autowired
    private UserMapper userMapper;


    public User selectByUsernameAndPassword(String username, String password) {

        return userMapper.selectUserByUsernameAndPassword(username, password);
    }

    public User selectUserById(Long userId) {
        return userMapper.selectByPrimaryKey(userId);
    }

    public void updateUserById(User user) {
        userMapper.updateByPrimaryKey(user);
    }

    public User selectUserByUsername(String username) {
        return this.userMapper.selectUserByUsername(username);
    }

    public void insertUser(User user) {
        this.userMapper.insert(user);
    }
}
